<div class="wrapper">
        
        <form id="database_form" order="{{ order_name }}">
        <div id="add_database_content" order="{{ order_name }}" style="display:none">
            <table>
                <tr>
                    <td width="1">
                        Название базы:<input type="text" name="database_name" order="{{ order_name }}" />
                    </td>
                    <td class="status" align="left"></td>
                </tr>
            </table>
            <a href="" id="add_database" order="{{ order_name }}">добавить</a>
            <div id="load_icon_create_db" order="{{ order_name }}" style="display:none">
                Отправление запроса <img alt="загрузка" src="{{ asset('bundles/billing/i/load.gif') }}">
            </div>
        </div>
        </form>

        <div class="c">
            <table>
            <tr>
                <td align="right">
                    <a href="" id="add_database_link" class="action" order="{{ order_name }}">Добавить базу данных</a>
                </td>
                <td align="left">
                    <a href="" class="action">Востановление базы данных</a>
                </td>
                <td align="right">
                    <a href="" id="synch_database" class="action" order="{{ order_name }}">Синхронизировать базы данных</a>
                    <div id="load_icon_synch_db" order="{{ order_name }}" style="display:none">
                        Синхронизация баз данных <img alt="загрузка" src="{{ asset('bundles/billing/i/load.gif') }}">
                    </div>
                    <div id="load_icon_synch_error" order="{{ order_name }}">
                    </div>
                </td>
            </tr>
            </table>
        </div>

    <div id="database_list" order="{{ order_name }}">
        {% for key, base in databases_users %}
            {% if base['database'].getIsActive %}
                {% include "BillingBundle:Orders_shared:user_index_active_database_template.html.twig" %}
            {% else %}
                {% include "BillingBundle:Orders_shared:user_index_not_active_database_template.html.twig" %}
            {% endif %}
        {% endfor %}
    </div>
    <script type="text/javascript">
    var validator = $('#database_form[order="{{ order_name }}"]').validate({
            rules: {
                    database_name: {
                            check_mysql: true,
                            required: true,
                            maxlength: 64
                    }
            },
            messages: {
                    database_name: {
                            required: "Введите название",
                            maxlength: jQuery.format("Не более {0} символов")
                    }
            },

            errorPlacement: function(error, element) {
                    error.appendTo( element.parent().next() );
            },
            success: function(label) {
                    // set &nbsp; as text for IE
                    label.html("&nbsp;").addClass("checked");
            }
    });
    </script>
</div>
